import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
// import storeGrp from './storeGrp';

import bootstrap from 'bootstrap';
import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.min.css';
import 'ztree/css/zTreeStyle/zTreeStyle.css';
import 'ztree/js/jquery.ztree.core.js';
import 'ztree/js/jquery.ztree.excheck.js';
import 'ztree/js/jquery.ztree.exedit.js';
import 'ztree/js/jquery.ztree.exhide.js';
//element-ui
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI)

import echarts from'echarts';
Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false;
Vue.use(bootstrap);
Vue.prototype.$http = axios;
//axios请求拦截器
axios.interceptors.request.use(function (config) {
  //增加请求头，便于登录过期跳转
  config.headers['X-Requested-With']='XMLHttpRequest';
  return config;
});
//axios响应拦截拦截器
Vue.prototype.$http.interceptors.response.use(
  function (response) {
    return response;
  },function (error) {
    if(error.response !== undefined && error.response.status === 412){
      window.location = '/portal/login';
    }else{
      window.cancel();
      global.msg_instance.showMsgNew({
        title : 'COMMON_012'
      });
    }
    return error;
});

import utils from '@/components/Utils';
Vue.prototype.$utils = utils;

//全局变量系统名
Vue.prototype.$sysName = '新規離反分析NEW'
//系统组件
import pageHead from '@/components/page_head.vue';
import pageFooter from '@/components/page_footer.vue';
import msg from 'msg';
global.msg_instance=new msg(window.$);
global.msg_instance.init({sys: global.systemCd});
Vue.config.devtools = true;
Vue.component('pageHead',pageHead);
Vue.component('pageFooter',pageFooter);

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  // storeGrp,
  render: h => h(App)
}).$mount('#app');
